<?php

/*
 * This file is part of the Geek-Zoo Projects.
 *
 * @copyright (c) 2010 Geek-Zoo Projects More info http://www.geek-zoo.com
 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License
 * @author xuanyan <xuanyan@geek-zoo.com>
 *
 */


require_once ROOT_PATH.'/Abstract/front_abstract.php';

class Action extends front_abstract
{
    function index()
    {
        $face = $this->api->emotions($this->access_token);
        $faces = array();
        foreach ($face as $key => $val) {
            $val['category'] || $val['category'] = '默认';
            if (!isset($faces[$val['category']])) {
                $faces[$val['category']] = array();
            }
            $faces[$val['category']][] = $val;
        }
        $faces = array_slice($faces, 0, 8);
        
        // $face = array();
        // foreach ($t as $key => $val) {
        //    $face[$val['phrase']] = '<img src="'.$val['url'].'" />';
        // }
        $this->smarty->assign('data', $faces);
        $this->smarty->display('lib/emotions.html');
    }
}

?>